package com.yh.csx.event.store.gateway.backup;

import com.yh.csx.event.store.event.dto.req.EventReq;
import com.yh.csx.event.store.event.dto.resp.EventResp;
import com.yh.csx.event.store.gateway.backup.dataobject.BizEventBakDo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;
import java.util.List;
@Repository
public interface EventBakRepository extends JpaRepository<BizEventBakDo,String> {

    @Modifying
    @Transactional
    @Query(nativeQuery = true, value = "insert ignore into biz_event_bak (select * from biz_event where event_id in (select event_id from biz_event_result_temp ))")
    void move2Bak();

    @Modifying
    @Transactional
    @Query(nativeQuery = true, value = "delete from biz_event where event_id in ( select event_id from biz_event_result_temp )")
    void delEvent();
}
